
let person = {
}

// console.log(person.profile.name ?? "Anonymous")           // Cannot read property 'name' of undefined
console.log(person?.profile?.name ?? "Anonymous")           // Anonymous
console.log(person?.profile?.age ?? 18)                     // 18

